package com.ruoyi.shopping.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.shopping.mapper.MallCommentMapper;
import com.ruoyi.shopping.domain.MallComment;
import com.ruoyi.shopping.service.IMallCommentService;

/**
 * 商品评价Service业务层处理
 *
 * @author scx
 * @date 2022-06-10
 */
@Service
public class MallCommentServiceImpl implements IMallCommentService
{
    @Autowired
    private MallCommentMapper mallCommentMapper;

    /**
     * 查询商品评价
     *
     * @param id 商品评价主键
     * @return 商品评价
     */
    @Override
    public MallComment selectMallCommentById(Long id)
    {
        return mallCommentMapper.selectMallCommentById(id);
    }

    /**
     * 查询商品评价列表
     *
     * @param mallComment 商品评价
     * @return 商品评价
     */
    @Override
    public List<MallComment> selectMallCommentList(MallComment mallComment)
    {
        return mallCommentMapper.selectMallCommentList(mallComment);
    }

    /**
     * 新增商品评价
     *
     * @param mallComment 商品评价
     * @return 结果
     */
    @Override
    public int insertMallComment(MallComment mallComment)
    {
        mallComment.setCreateTime(DateUtils.getNowDate());
        return mallCommentMapper.insertMallComment(mallComment);
    }

    /**
     * 修改商品评价
     *
     * @param mallComment 商品评价
     * @return 结果
     */
    @Override
    public int updateMallComment(MallComment mallComment)
    {
        mallComment.setUpdateTime(DateUtils.getNowDate());
        return mallCommentMapper.updateMallComment(mallComment);
    }

    /**
     * 批量删除商品评价
     *
     * @param ids 需要删除的商品评价主键
     * @return 结果
     */
    @Override
    public int deleteMallCommentByIds(Long[] ids)
    {
        return mallCommentMapper.deleteMallCommentByIds(ids);
    }


    /**
     * 批量逻辑删除商品评价
     *
     * @param ids 需要删除的商品评价主键
     * @return 结果
     */
    @Override
    public int logicDeleteMallComment(Long[] ids,String delType,Long delUser)
    {
        return mallCommentMapper.logicDeleteMallComment(ids,delType,delUser);
    }

    /**
     * 删除商品评价信息
     *
     * @param id 商品评价主键
     * @return 结果
     */
    @Override
    public int deleteMallCommentById(Long id)
    {
        return mallCommentMapper.deleteMallCommentById(id);
    }
}
